package com.cpx.feign;

import com.cpx.dto.PageBeanDto;
import com.cpx.po.Goods;
import com.cpx.po.GoodsBrand;
import com.cpx.po.GoodsCategory;
import com.cpx.po.GoodsSupplier;
import feign.RequestLine;
import feign.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.servlet.ServletOutputStream;
import javax.xml.ws.RequestWrapper;
import java.util.List;

/**
 * @Auther: PanBin
 * @Date: 2018-11-13 17:24
 * @Version: 1.0
 */
@FeignClient(name = "CPX-MANAGER-SERVICE"/*,fallback = GoodsHystrix.class*/)
public interface GoodsFeign {

    /**
     * @Author: PanBin
     * @Description: 获取商品分类的树
     * @CreateDate: 2018-11-23 13:55
     * @Param [goodsCategory]
     * @Return java.util.List<com.cpx.po.GoodsCategory>
     */
    @RequestMapping(value = "/goods/getCategoryTree",method = RequestMethod.POST)
    List<GoodsCategory> getCategoryTree(GoodsCategory goodsCategory);

    /**
     * @Author: PanBin
     * @Description: 分配商品分类节点
     * @CreateDate: 2018-11-23 13:55
     * @Param [goodsCategory, type]
     * @Return int
     */
    @RequestMapping(value = "/goods/updateCategoryNode",method = RequestMethod.POST)
    int updateCategoryNode(@RequestBody GoodsCategory goodsCategory,@RequestParam("type") Integer type);

    /**
     * @Author: PanBin
     * @Description: 添加商品
     * @CreateDate: 2018-11-23 17:10
     * @Param [goods]
     * @Return int
     */
    @RequestMapping(value = "/goods/insertSelective",method = RequestMethod.POST)
    int insertSelective(Goods goods);

    /**
     * @Author: PanBin
     * @Description: 获取品牌列表，分页
     * @CreateDate: 2018-11-27 10:04
     * @Param [goodsBrand]
     * @Return com.cpx.dto.PageBeanDto<com.cpx.po.GoodsBrand>
     */
    @RequestMapping(value = "/goods/selectBrandPage",method = RequestMethod.POST)
    PageBeanDto<GoodsBrand> selectBrandPage(@RequestBody GoodsBrand goodsBrand,@RequestParam("pageSize") Integer pageSize,@RequestParam("pageNum") Integer pageNum);

    /**
     * @Author: PanBin
     * @Description: 添加品牌
     * @CreateDate: 2018-11-27 10:39
     * @Param [goodsBrand]
     * @Return int
     */
    @RequestMapping(value = "/goods/addBrand",method = RequestMethod.POST)
    int addBrand(GoodsBrand goodsBrand);

    /**
     * @Author: PanBin
     * @Description: 删除品牌
     * @CreateDate: 2018-11-27 14:54
     * @Param [brandIds]
     * @Return int
     */
    @RequestMapping(value = "/goods/delBrand",method = RequestMethod.POST)
    int delBrand(@RequestParam("brandIds") Integer[] brandIds);

    /**
     * @Author: PanBin
     * @Description: 编辑品牌
     * @CreateDate: 2018-11-27 15:52
     * @Param [goodsBrand]
     * @Return int
     */
    @RequestMapping(value = "/goods/editBrand",method = RequestMethod.POST)
    int editBrand(GoodsBrand goodsBrand);

    /**
     * @Author: PanBin
     * @Description: 导出品牌
     * @CreateDate: 2018-11-28 10:08
     * @Param [outputStream, goodsBrand]
     * @Return void
     */
    @RequestMapping(value = "/goods/exportBrand",method = RequestMethod.POST)
    Response exportBrand(@RequestBody GoodsBrand goodsBrand);

    /**
     * @Author: PanBin
     * @Description: 分页获取供应商列表
     * @CreateDate: 2018-11-30 10:05
     * @Param [goodsSupplier, pageSize, pageNum]
     * @Return com.cpx.dto.PageBeanDto<com.cpx.po.GoodsSupplier>
     */
    @RequestMapping(value = "/goods/selectSupplierPage",method = RequestMethod.POST)
    PageBeanDto<GoodsSupplier> selectSupplierPage(@RequestBody GoodsSupplier goodsSupplier,@RequestParam("pageSize") Integer pageSize,@RequestParam("pageNum") Integer pageNum);

    /**
     * @Author: PanBin
     * @Description: 新增供应商
     * @CreateDate: 2018-11-30 10:57
     * @Param [goodsSupplier]
     * @Return int
     */
    @RequestMapping(value = "/goods/addSupplier",method = RequestMethod.POST)
    int addSupplier(GoodsSupplier goodsSupplier);

    /**
     * @Author: PanBin
     * @Description: 编辑供应商
     * @CreateDate: 2018-11-30 11:19
     * @Param [goodsSupplier]
     * @Return int
     */
    @RequestMapping(value = "/goods/editSupplier",method = RequestMethod.POST)
    int editSupplier(GoodsSupplier goodsSupplier);

    /**
     * @Author: PanBin
     * @Description: 删除供应商
     * @CreateDate: 2018-11-30 13:42
     * @Param [supplierIds]
     * @Return int
     */
    @RequestMapping(value = "/goods/delSupplier",method = RequestMethod.POST)
    int delSupplier(@RequestParam("supplierIds") Integer[] supplierIds);

    /**
     * @Author: PanBin
     * @Description: 导出供应商
     * @CreateDate: 2018-11-30 13:59
     * @Param [goodsSupplier]
     * @Return feign.Response
     */
    @RequestMapping(value = "/goods/exportSupplier")
    Response exportSupplier(GoodsSupplier goodsSupplier);
}
